module DisOrder
  class Build
    extend Helpers

    def self.build
      if File.directory?(config("output")) == false
        Dir.mkdir(config("output"))
        puts "-- Created Build Folder \n".white
      else
        FileUtils.remove_dir(config("output"))
        puts "-- Deleted Previous Build Folder".red
        Dir.mkdir(config("output"))
        puts "-- Created Build Folder \n".white
      end
      Dir.mkdir(config("output")+"/static")
      FileUtils.cp_r(config("foldersToCopy"), config("output")+"/static")
      puts "-- Copied Static Folders \n".white

      Index.build()

      puts "-- Make Static Pages \n".white
      Pages.build(config("metaDataFilePages"), config("baseStaticFolder"))
      puts "-- Make Article Pages \n".white
      Pages.build(config("metaDataFileArticels"), config("baseArticlesFolder"))
    end
  end
end